package com.ctp.ui.table.base;

import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;

public class DisplayTableModel extends DefaultTableModel {

	private static final long serialVersionUID = 1L;

	private JTable parentTable = null;

	public DisplayTableModel(JTable parentTable) {
		this.parentTable = parentTable;
	}

	public void setValueAt(double value, int row, int column) {
		setValueAt(Double.toString(value), row, column);
	}

	public void setValueAt(int value, int row, int column) {
		setValueAt(Integer.toString(value), row, column);
	}

	public boolean isCellEditable(int row, int column) {
		return parentTable.getColumnModel().getColumn(column).getCellRenderer() instanceof TableCellEditor;
	}

}
